#ifndef _Adapter_Bridge
#define _Adapter_Bridge

//#include <windows.h>
//#include "4Way.h"


///////////////////////////////////////////////////////////////////////
//Defintion
///////////////////////////////////////////////////////////////////////
#define MAX_SSID_LENGTH 32
#define MAC_ADDR_LENGTH 6


// 20060802 Add
#define WB_WPA_PSK_FRAME_SIZE( _A )		(_A->Global_STA_Wpa.FrameSize)


#define ADAPTER_UNSUCCESSFUL 0
#define ADAPTER_SUCCESSFUL   1

//To redefine the type of adapter
#define HANDLE PWB32_ADAPTER

typedef struct _IE_INFO
{
	u32	IesLen;
	//u8	IesData[1000];
	u8	IesData[1024];
} IES_INFO, *PIES_INFO;
/*
typedef struct _ChanInfo
{
	u8		band;
	u8		ChanNo;
} ChanInfo, *pChanInfo;
*/

typedef struct _STA_EAPOL_STATUS{
	u8		StationAddr[6];
	u16		AssocStatus;
	//u8		BufIdx;		//If it is EAPOL packet
	//u8		Reserved[3];
	u32		PacketSize;
	u8		EapolFrame[1000];
} STA_EAPOL_STATUS, *pSTA_EAPOL_STATUS;


////////////////////////////////////////////////////////////////
//NDIS defintion
////////////////////////////////////////////////////////////////
/*
typedef MACAddress NDIS_802_11_MAC_ADDRESS;
typedef struct _NDIS_802_11_AI_REQFI
{
    u16 Capabilities;
    u16 ListenInterval;
    NDIS_802_11_MAC_ADDRESS  CurrentAPAddress;
} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;

typedef struct _NDIS_802_11_AI_RESFI
{
    u16 Capabilities;
    u16 StatusCode;
    u16 AssociationId;
} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;

typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
{
    u32                   Length;
    u16                  AvailableRequestFixedIEs;
    NDIS_802_11_AI_REQFI    RequestFixedIEs;
    u32                   RequestIELength;
    u32                   OffsetRequestIEs;
    u16                  AvailableResponseFixedIEs;
    NDIS_802_11_AI_RESFI    ResponseFixedIEs;
    u32                   ResponseIELength;
    u32                   OffsetResponseIEs;
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;

*/

// For station
//*****************************************************************
typedef struct _STAWpaDescriptionElement
{
//	HANDLE		  m_Device;   //Adapter device Handle
//	STAList		  AP_STA_LIST; //To retrieve the Station List, Added by WangJS 2005.9.19
	STATION       WPA_STA;
	u8            SSID[MAX_SSID_LENGTH];
    
	u8		      AdapterMAddress[MAC_ADDR_LENGTH]; // peer MAC Address associated with this session. 6-OCTET value
	u8			  AuthenicationMode; //To check the Auth mode, added by WangJS 2005.9.7
	u8            EncryptionMode;    //To check the encryption mode
	
	u8			  WPAPassword[128]; //Modified by WangJS 2006.8.22, To en-large the password length
	//To record the RSN IE
	//IES_INFO		Ies;
	//To record the Group Key
//	GroupMasterKey   GMP;

	// 20060802 Add
	PUCHAR	Frame; // Start address of sending frmae
	u16	FrameSize; // The frame size of sending frame
	u16	Reserved;

}__attribute__ ((packed))  WB_STA_WPA_DESCRIPTION, *PWB_STA_WPA_DESCRIPTION;

//extern pWB_STA_WPA_DESCRIPTION pGlobal_STA_Wpa;
//*****************************************************************


void SendEAPoLPacket(void* DeviceHandle, u8* Buffer, u32 BufferSize);
void GetEAPoLPacket(void* DeviceHandle, void* pDes); // 20060802
void GetEAPoLPacketComplete(void* DeviceHandle, void* pDes); // 20060802
u32 SetAddKey(void* DeviceHandle, /*unsigned char**/AP_802_11_KEY* KeyMaterial);
//u32 SetDeAuthentication(void* DeviceHandle, MACAddress* DA, u16 ReasonCode);
//u32 SetDeAssocation(void* DeviceHandle, MACAddress* DA, u16 ReasonCode);
//u32 GetEAPoLPacket(void* DeviceHandle, /*StationStatus&*/STA_EAPOL_STATUS* StationPacket);

//void GetBssid(void* pAdapter, u8* Bssid);
//void GetMACAddress(void* pAdapter, u8* MACAddress);
void GetRsnElement(void* DeviceHandle, u8* RSN, u32 RSN_Length);
#endif


